package testes;

import java.awt.*;
import javax.swing.*;
import java.awt.geom.*;

public class EffectsOfStroke extends JPanel {

    public void paint(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        double p = 12, q = 45, width = 65, height = 65;
        Rectangle2D rectangle = new Rectangle2D.Double(p, q, width, height);

        GradientPaint gradientPaint = new GradientPaint(75, 75, Color.red, 90, 90, Color.cyan, true);
        g2d.setPaint(gradientPaint);
        g2d.fill(rectangle);        
        g2d.setPaint(gradientPaint);
        rectangle.setFrame(p + 90, q, width, height);
        g2d.setStroke(new BasicStroke(10));
        g2d.draw(rectangle);
        rectangle.setFrame(p + 180, q, width, height);
        g2d.setPaint(Color.black);
        g2d.draw(rectangle);
    }

    public static void main(String[] args) {
        JFrame frame = new JFrame("Show Effect");
        frame.getContentPane().add(new EffectsOfStroke());
        frame.setSize(350, 200);
        frame.show();
    }
}



